
// ERR semicolon missing
int x=5;
cout << "x = " << x << endl


// SyntaxOK Logical problem: permanent loop
int a=5;
while(a < 10);{
    cout << a;
    a++;
}

// ERR variable undefined 
int x = x+1;

// ERR variable undefined
int pinigai = 5, kebabas = 2;
if ( pinigai > kebabas ){
    pinigai = piginai - kebabas;
}

// WARN variable uninitialized
int sum;
for(int  kiek=2; kiek<10; kiek=kiek+2){
    sum += kiek;
}

// WARN variable uninitialized; ERR commas instead of semicolons
int sum;
for(int  kiek=2, kiek<10, kiek=kiek+2){
    sum += kiek;
}


// SyntaxOK Memory problem: array out of bounds access
int A[4] = {5, 3, 2};
for(int i=0; i<5; i++){
    A[i] = A[i]*2; 
}

// SyntaxOK Use of uninitialized values  
int A[4];
for(int i=0; i<4; i++){
    A[i] = A[i]*2; 
}

// OK
int A[5];
for(int i=0; i<4; i++){
    A[i] = 2; 
}

// ERR too few arguments to function 
#include <string>

void greeting(string name){
    cout << "Hi, "<< name;
}
/*main*/
    string name="Petras";
    greeting ();


// ERR   a function-definition is not allowed here (inside other function)
int main(){
    void seka(int n){
        for(int i=0; i<n; i++){
            cout << i << " ";
    }
    
    seka(5);
    seka(3);
}  

// WARN  no return statement in function returning non-void
int add(int a, int b){
    cout << a+b;
}
int main(){
    int rez = add(5, 2);

}  


// ERR   expected ‘(’ before variable name
int a=8;
if a > 5 {
    cout << "OK" << endl;
}

// WARN suggest parentheses around assignment used as truth value 
int a=5;
if (a = 3){
    cout << "ups" ;
}

// ERR  lvalue required as left operand of assignment
int a=5;
if (3 = 5){
    cout << "OK" ;
}


// ERR invalid conversion from ‘int’ to ‘int*’ 
int sumuok3(int skaiciai[]){
    int rez=0;
    for(int i=0; i< 3; i++){
        rez = rez + skaiciai[i];
    }
    return rez;
}
/*main*/
int A[]={2, 5, 7};
int s = sumuok3(A[0]);


// SyntaxOK Logical problem: condition checking doesn't make difference 
int a=5;
if(a < 10);{
    cout << a;
}

// ERR expected ‘}’ at end of input

int a=5;
for(int i=0; i<a; i++){
    if(i < a/2){
        cout << a;
}

// OK
int a=5;
for(int i=0; i<a; i++){
    if(i > a/2)
        cout << a;
}


// ERR expected declaration before ‘}’ token

int a=5;
for(int i=0; i<a; i++){
    if( i*2 > a){
        cout << a;}
    }
}


// ERR no match for ‘operator>>’ in ‘std::cout >> a’
int a=7;
for(int i=0; i<a; i++){
    if(i < a/2){
        cout >> a;
    }
}

// ERR  ‘count’ was not declared in this scope
int a=7;
for(int i=0; i<a; i++){
        count << i;
}

// ERR expected ‘;’ before ‘<’ token
for(int i=0, i<5, i++){
        cout << i;
}

// ERR  name lookup of variable changed for ISO ‘for’ scoping
int j=0;
for(int i=0; i<5; i++){
    j = j+i;
}
cout << i;

// ERR return-statement with a value, in function returning 'void' 
void suma(int a, int b){
    return a+b;
}
/*main*/
int x=50;
int z;
z=suma(x, 20);

// ERR   expected primary-expression before ‘}’ token. expected ‘;’ before ‘}’ token
int a=0;
for(int i=0; i < a; i++){
    if(i > 3)
}
    cout << a;
